using System;
using System.ComponentModel.Composition;
using Boggle.Net.Model;

namespace Boggle.Net.Tests.Stubs
{
    [Export(typeof(IStopwatch))]
    internal sealed class Stopwatch : IStopwatch
    {
        private TimeSpan _totalRunningTime;

        public event EventHandler Tick = delegate { };

        public void Dispose()
        {
        }

        public bool IsRunning
        {
            get;
            set;
        }

        public TimeSpan TotalRunningTime
        {
            get { return _totalRunningTime; }
            set
            {
                _totalRunningTime = value;
                Tick(this, EventArgs.Empty);
            }
        }

        public void Reset()
        {
            _totalRunningTime = TimeSpan.Zero;
        }
    }
}